<style scoped>
    .main {
        height: 100%;
    }

    .main >>> .hd-logo {
        width: auto;
        height: 100%;
    }

    .main >>> .layout-logo {
        width: 36%;
    }

    .main >>> .layout-menus {
        float: left;
        width: 25%;
    }

    .home-login {
        color: white;
        font-size: 18px;
        font-weight: bold;
        cursor: pointer;
    }

    .home-name {
        color: white;
        font-size: 18px;
        font-weight: bold;
        margin-right: 15px;
    }

    .home-btn {
        color: white;
        font-size: 18px;
        font-weight: bold;
        cursor: pointer;
        margin-right: 15px;
    }
</style>

<template>
    <div class="main">
        <main-theme2
                :siderWidth="220"
                ref="mainTheme"
                collapsible
                homeName="首页"
                :headerMenusShow="closeHeaderMenu"
                :headerTextStyle="headerTextStyle"
                logoPath="https://house-manager.oss-cn-qingdao.aliyuncs.com/header/demoHeaderBlue.png">
            <router-view></router-view>
        </main-theme2>
    </div>
</template>

<script>
import { mapActions } from 'vuex'
import menus from '@/mock/data/php-menus.js'

export default {
  data () {
    return {
      closeHeaderMenu: true,
      severUserInfo: {},
      headerTextStyle: { text: '公务加油卡监督系统', lineWidth: '550px' }
    }
  },
  methods: {
    ...mapActions([
      'getUserInfo',
      'setUserInfo',
      'getPhpMenusData',
      'getJavaMenusData',
      'setMenuListData'
    ]),
    guide () {
      window.open('https://note.youdao.com/ynoteshare1/index.html?id=9790a7d1920d83c7d1b95292ecb6005b&type=note')
    },
    logout () {
      this.$refs.mainTheme.logout()
    }
  },
  computed: {
    getUserName () {
      if (this.severUserInfo.data) {
        return this.severUserInfo.data.company_name + '【' + this.severUserInfo.data.loginName + '】'
      } else {
        return '未登录'
      }
    }
  },
  mounted () {
    // TODO 如果是java菜单还需要调用综合菜单-id需要自己配置
    this.setMenuListData(menus.data)
    // this.getUserInfo().then(resx => {
    // })
    this.severUserInfo = this.$store.state.user.severUserInfo
    // this.getJavaMenusData('0,1,2d673086-6a88-11ea-b1d1-0242ac110004')
  }
}
</script>
